﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using CE.HR;

public partial class HR_HRMasterPage : System.Web.UI.MasterPage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        string _strCXLive = CE.Configuration.MyConfigurationManager.GetAppSettingValue("IsCXLive");
        if (_strCXLive == "0")
        {
            if (Session[CE.Global.General.Guest] == null)
            {
                Response.Redirect("~/Default2.aspx");
            }
        }

        if (Session[CE.Global.General.HRTypeId] != null)
        {
            if (Session[CE.Global.General.HRTypeId].ToString() == "Admin")
            {
                aHR.Visible = true;
                aJA.Visible = false;
                aJP.Visible = false;
                aJS.Visible = false;
            }
        }

        if (!IsPostBack)
        {
            if (Session[CE.Global.General.HRId] != null)
            {
                Int64 _hrid = Int64.Parse(Session[CE.Global.General.HRId].ToString());
                HRAccountDB _accountdb = new HRAccountDB();
                HRAccount _account = _accountdb.GetAccount(_hrid);

                lblName.Text = _account.Name + " (" + _account.Country + ")";
            }
        }
    }
}
